/* @(#)GSOrderSignInfoSaveAction.java   
 *
 * Project: GS
 *
 * Modify Information:
 * =============================================================================
 *   Author       Date       Description
 *   ------------ ---------- ---------------------------------------------------
 *   Jenny Li    2006-3-19     新增
 *
 * Copyright Notice:
 * =============================================================================
 *    Copyright (c) 2001-2006 Beijing HiTRUST Technology Co., Ltd. 1808 Room, 
 *        Science & Technology Building, No. 9 South Street, Zhong Guan Cun, 
 *        Haidian District, Beijing ,100081, China All rights reserved.
 *
 *    This software is the confidential and proprietary information of
 *        Beijing HiTRUST Technology Co., Ltd. ("Confidential Information").
 *        You shall not disclose such Confidential Information and shall use it
 *        only in accordance with the terms of the license agreement you entered
 *        into with HiTRUST.
 *
 * Warning:
 * =============================================================================
 * 
 */
package com.hitrust.gs.action;

import java.util.HashMap;

import com.hitrust.gs.bean.GSOperatorBean;
import com.hitrust.gs.bean.GSOrderDetailBean;
import com.hitrust.gs.business.GSManufactureProcessor;
import com.hitrust.gs.business.GSOrderDeptInfoProcessor;
import com.hitrust.gs.business.GSOrderProcessor;
import com.hitrust.gs.form.GSOrderSignInfoSaveNonFlatForm;
import com.hitrust.gs.lib.GSBaseConstants;
import com.hitrust.gs.service.GSBaseAction;
import com.hitrust.gs.service.GSBaseForm;

/**
 * 非网上订单明细签收信息保存
 */
public class GSOrderSignInfoNonFlatSaveAction extends GSBaseAction {


    public String execute(GSBaseForm aForm) throws Exception {
        //取得待保存信息
        GSOrderSignInfoSaveNonFlatForm tForm = (GSOrderSignInfoSaveNonFlatForm)aForm;
        GSOrderDetailBean tOrderDetailBean = new GSOrderDetailBean();
        tOrderDetailBean.setGs_order_detail_id(tForm.curOrderDetailId);
        tOrderDetailBean.setGs_order_temp_id(tForm.curOrderId);
        tOrderDetailBean.setGs_deliver_goods_id(tForm.devGoodsOrderId);
        tOrderDetailBean.setGs_signin_person(tForm.signer);
        tOrderDetailBean.setGs_signin_count(tForm.signCount);
        tOrderDetailBean.setGs_signin_date(tForm.signDate);
        tOrderDetailBean.setGs_goods_unitprice(tForm.goodsUnitprice);
        tOrderDetailBean.setGs_deliveryman(tForm.contactPerson);
        tOrderDetailBean.setGs_deliver_goods_phone(tForm.contactPhone);
        //取得当前操作员信息
        GSOperatorBean tOper = (GSOperatorBean)tForm.getSession().getAttribute(GSBaseConstants.LOGIN);
        tOrderDetailBean.setGs_lastmodifer_id(tOper.getGs_oper_id());
        GSOrderProcessor tOrderProc = new GSOrderProcessor();
        //调用保存签收信息操作
        boolean tFlag = tOrderProc.saveSignInfoOfNonFlat(tOrderDetailBean);
        if(tFlag){
            tForm.getRequest().setAttribute("message","编号为" + tOrderDetailBean.getGs_order_detail_id()+"的订单收货信息录入成功!");
        }else{
            tForm.getRequest().setAttribute("message","编号为" + tOrderDetailBean.getGs_order_detail_id()+"的订单收货信息录入失败!");
        }
        tForm.getRequest().setAttribute("requery","true");
        tForm.getRequest().setAttribute("window","true");//为出现异常准备参数
        
        //取得当前操作员可查询的订货单位和送货地址
        GSOperatorBean tOperBean = (GSOperatorBean)aForm.getSession().getAttribute(GSBaseConstants.LOGIN);
        GSOrderDeptInfoProcessor tProc = new GSOrderDeptInfoProcessor();
        HashMap tMap = tProc.getOrderDeptInfoOfBusOper(tOperBean.getGs_oper_org_id());
        aForm.getRequest().setAttribute("orderdept",tMap);
        //取得产品分类
        GSManufactureProcessor tManufProc = new GSManufactureProcessor();
        tManufProc.getManufactureOfLevel(aForm);
        
        return GSBaseConstants.FORWARD_SUCCESS;
    }

}
